import * as constant from "./actionTypes.js";
import { fromJS } from 'immutable';

//immutable facebook提供 不可更改的对象  只能get ， set方法
const defaultState = fromJS({
	focused: false,
	list : []
})

//set方法是返回新对象  不是改变内容
export default ( state = defaultState, action )=>{

	if(action.type === constant.NAV_SEARCH_INPUT){
		return state.set('focused', action.value);
	}

	if(action.type === constant.CHANGE_LIST){
		console.log(action.data);
		return state.set('list', action.data);
	}

	return state;
}
